/*
数据结构 解题报告：
http://git.oschina.net/et0662/sznoi-Data_Structure
*/
#include<stdio.h>

int num=0;
void move(char x,int i, char z)
{
	num++;
	printf("%2d. Move disk %d from %c to %c\n",num,i,x,z);
}

void hanoi(int n, char x, char y, char z)
{
	if(n==1)
		move(x,1,z);
	else
	{
		hanoi(n-1,x,z,y);
		move(x,n,z);
		hanoi(n-1,y,x,z);
	}
}

int main(void)
{
	int n;
	scanf("%d",&n);
	hanoi(n,'X','Y','Z');
	return 0;
}
